var $server="http://localhost:8080/eduhappok/";
var $address = window.location.pathname;
$address = $address.substring($address.lastIndexOf('/')+1, $address.length-4);
var $server_address = $server+$address+".do";

$(document).ready(function() {
	$(":button").each(function (){
		$("#"+this.name).bind("click",function(){
			model(this.name);
		});
	});
});

function model(val) {
	htmlobj = $.ajax({
		type : "POST",
		url : $server_address,
		contentType : "application/json",
		data : $("#" + val + "txt").val(),
		dataType : "json",
		success : function(data) {
			$("#" + val + "rel").val(JSON.stringify(data));
		}
	});
}

